-module(put500k_socket).

-compile(export_all).

test() ->
    
    Vals = test_lib:random_key_value_pairs(50000),

    test_lib:socket_start(),

    io:format("Inserting 500k values using socket:put()~n"),
    FirstTimestamp = os:timestamp(),
    
    test_lib:socket_put_list(Vals),    

    SecondTimeStamp = os:timestamp(),

    test_lib:socket_stop(),

    io:format("Done! Total time: ~w~n",
        [time_stamp_diff(FirstTimestamp,SecondTimeStamp)]).



% Borrowing Kristian's code
time_stamp_diff(Time1,Time2) ->
   {A,B,C} = Time1,
   {D,E,F} = Time2,
   {_,H,I} = {D-A,E-B,F-C},
   %% H * 1000, G * 1 billion
   H + (I / 1000000).
